package com.xiang.community.dao;

import com.xiang.community.dto.MessageCountDTO;
import com.xiang.community.entity.Message;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.web.bind.annotation.PathVariable;

import java.util.List;
import java.util.Map;

@Mapper
public interface MessageMapper {

    List<Message> selectConversations(@Param("userId") int userId, @Param("messageType") String messageType);

    int insertMessage(Message message);

    int updateStatus(List<Integer> ids, int status, int userId);

    List<Message> getMessages(@Param("conversationId") String conversationId, @Param("userId") int userId);

    MessageCountDTO countMessage(@Param("conversationId") String conversationId, @Param("userId") Integer userId);

    int getUnreadConversationCount(@Param("userId") int userId);

    List<Message> selectSystemMessage(@Param("userId") int userId);

    Message getMessage(@Param("messageId") Integer messageId, @Param("userId") Integer userId);

    void deleteConversation(@Param("conversationId") String id, @Param("userId") Integer userId);

    int countUnreadSystemMessage(@Param("userId") int id);

    Message getLastMessage(@Param("conversationId") String conversationId, @Param("userId") int userId);
}
